/*
 * Copyright 2015 William Wang.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package wxk.Bonus.utils;

import java.util.Locale;
import java.util.ResourceBundle;
import java.text.MessageFormat;  
/**
 * Jan 27, 20151:16:19 PM
 * @author William Wang
 */
public class MessageUtils {
static private ResourceBundle globalrb = java.util.ResourceBundle.getBundle("wxk/Bonus/resources/messages");

    public static void setResourceBundler(String language) 
    {
    globalrb = java.util.ResourceBundle.getBundle("wxk/Bonus/resources/messages",new Locale(language));
    }
 
static public String   geti18nMessage(String key)
 {
 String msg="";
 msg=globalrb.getString(key);
 return msg;
 }
 
 static public String getFormatMessage(String key,Object...value)
 {
  String msg="";
  MessageFormat temp = new MessageFormat(geti18nMessage(key));  
  msg=temp.format(value);
  return msg;
 }
}
